package cn.iocoder.yudao.module.ym.util;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONArray;

import java.util.List;

public class CoordinateValidator {
    public static void main(String[] args) {
        String s = "[[[[4,1],[4.5]]]]";
        System.out.println(isValidCoordinateString(s));

    }
    public static boolean isValidCoordinateString(String input) {
        if(input.contains("{") || input.contains("}")){
            return false;
        }
        ObjectMapper mapper = new ObjectMapper();

        // 解析成 List<List<Number>>（兼容整数和浮点数）
        try {
            mapper.readValue(input, List.class);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

}
